import datetime


def take_screenshot(driver, file_name):
    try:
        screenshot_path = f'../screenshot/{file_name}_{datetime.datetime.now().strftime("%Y-%m-%d %H-%M-%S")}.png'
        driver.get_screenshot_as_file(screenshot_path)
        return screenshot_path
    except Exception as e:
        print(f"截图失败，{e}")
